package com.googlecode.transmutant.spring;

import java.util.HashMap;
import java.util.Map;

public class Captures {

	Map<String,Object> captureValues = new HashMap<String,Object>()
	Map<String,Capture> captures = new HashMap<String,Capture>()
	
	Object removeCapture(Capture capture) {
		def key = capture.name
		captureValues.remove(key)
		captures.remove(key)
	}
	
	Object getCapturedValue(String key) {
		return captureValues.get(key)
	}
	
	Object getCapture(String key) {
		return captures.get(key)
	}
	
	void capture(Object obj, Capture capture) {
		captures.put(capture.name,capture)
		captureValues.put(capture.name,obj)
	}
	
	void clear() {
		captures.clear()
		captureValues.clear()
	}
}
